﻿using Share.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
using static System.Runtime.InteropServices.JavaScript.JSType;

namespace Share.APIs;

public class QPayEnt : IcbcApiRequest
{
    internal override string Url => "api/mybank/enterprise/pay/qpayent/V1";
    [JsonPropertyName("trans_code")] public string TransCode => "QPAYENT";
    [JsonPropertyName("tran_date")] public string TranDate { get; set; } = DateTime.Today.ToString("yyyyMMdd");
    [JsonPropertyName("tran_time")] public string TranTime { get; set; } = DateTime.Now.ToString("HHmmssfff");
    [JsonPropertyName("language")] public string? Language { get; set; } = "zh_CN";
    [JsonPropertyName("f_seq_no")] public string FSeqNo { get; set; } = UtilitiesService.GetFSeqNo();
    [JsonPropertyName("qryf_seqno")] public string? QryfSeqno { get; set; } = string.Empty;
    [JsonPropertyName("qry_serial_no")] public string? QrySerialNo { get; set; } = string.Empty;
    [JsonPropertyName("saas_name")] public string? SaasName { get; set; } = string.Empty;
}


public class QPayEntResponse:IcbcApiResponse
{    
    [JsonPropertyName("qryf_seqno")] public string? QryfSeqno { get; set; } = string.Empty;
    [JsonPropertyName("qry_serial_no")] public string? QrySerialNo { get; set; } = string.Empty;
    [JsonPropertyName("zip_flag")] public string? ZipFlag { get; set; } = string.Empty;
    [JsonPropertyName("zip")] public string? Zip { get; set; } = string.Empty;
    [JsonPropertyName("onl_bat_f")] public string? OnlBatF { get; set; } = string.Empty;
    [JsonPropertyName("settle_mode")] public string? SettleMode { get; set; } = string.Empty;
    [JsonPropertyName("package_name")] public string? PackageName { get; set; } = string.Empty;
    [JsonPropertyName("rd")] public List<QPayEntResponseRd> Rd { get; set; } = [];

}

public class QPayEntResponseRd
{
    [JsonPropertyName("uni_busi_id")] public string? UniBusiId { get; set; } = string.Empty;
    [JsonPropertyName("i_seqno")] public string? ISeqno { get; set; } = string.Empty;
    [JsonPropertyName("qryi_seqno")] public string? QryiSeqno { get; set; } = string.Empty;
    [JsonPropertyName("qry_order_no")] public string? QryOrderNo { get; set; } = string.Empty;
    [JsonPropertyName("start_date")] public string? StartDate { get; set; } = string.Empty;
    [JsonPropertyName("pay_type")] public string? PayType { get; set; } = string.Empty;
    [JsonPropertyName("pay_acc_no")] public string? PayAccNo { get; set; } = string.Empty;
    [JsonPropertyName("pay_acc_name_cn")] public string? PayAccNameCn { get; set; } = string.Empty;
    [JsonPropertyName("pay_acc_name_en")] public string? PayAccNameEn { get; set; } = string.Empty;
    [JsonPropertyName("rec_acc_no")] public string? RecAccNo { get; set; } = string.Empty;
    [JsonPropertyName("rec_acc_name_cn")] public string? RecAccNameCn { get; set; } = string.Empty;
    [JsonPropertyName("rec_acc_name_en")] public string? RecAccNameEn { get; set; } = string.Empty;
    [JsonPropertyName("sys_io_flg")] public string? SysIoFlg { get; set; } = string.Empty;
    [JsonPropertyName("is_same_city")] public string? IsSameCity { get; set; } = string.Empty;
    [JsonPropertyName("rec_icbc_code")] public string? RecIcbcCode { get; set; } = string.Empty;
    [JsonPropertyName("rec_city_name")] public string? RecCityName { get; set; } = string.Empty;
    [JsonPropertyName("rec_bank_no")] public string? RecBankNo { get; set; } = string.Empty;
    [JsonPropertyName("rec_bank_name")] public string? RecBankName { get; set; } = string.Empty;
    [JsonPropertyName("curr_type")] public string? CurrType { get; set; } = string.Empty;
    [JsonPropertyName("pay_amt")] public decimal PayAmt { get; set; }
    [JsonPropertyName("use_code")] public string? UseCode { get; set; } = string.Empty;
    [JsonPropertyName("use_cn")] public string? UseCn { get; set; } = string.Empty;
    [JsonPropertyName("en_summary")] public string? EnSummary { get; set; } = string.Empty;
    [JsonPropertyName("post_script")] public string? PostScript { get; set; } = string.Empty;
    [JsonPropertyName("summary")] public string? Summary { get; set; } = string.Empty;
    [JsonPropertyName("ref")] public string? Ref { get; set; } = string.Empty;
    [JsonPropertyName("oref")] public string? Oref { get; set; } = string.Empty;
    [JsonPropertyName("erp_sqn")] public string? ErpSqn { get; set; } = string.Empty;
    [JsonPropertyName("bus_code")] public string? BusCode { get; set; } = string.Empty;
    [JsonPropertyName("erp_check_no")] public string? ErpCheckNo { get; set; } = string.Empty;
    [JsonPropertyName("crvouh_type")] public string? CrvouhType { get; set; } = string.Empty;
    [JsonPropertyName("crvouh_name")] public string? CrvouhName { get; set; } = string.Empty;
    [JsonPropertyName("crvouh_no")] public string? CrvouhNo { get; set; } = string.Empty;
    [JsonPropertyName("bank_type")] public string? BankType { get; set; } = string.Empty;
    [JsonPropertyName("result")] public string? Result { get; set; } = string.Empty;
    [JsonPropertyName("instr_ret_code")] public string? InstrRetCode { get; set; } = string.Empty;
    [JsonPropertyName("instr_ret_msg")] public string? InstrRetMsg { get; set; } = string.Empty;
    [JsonPropertyName("m_card_no")] public string? MCardNo { get; set; } = string.Empty;
    [JsonPropertyName("m_card_name")] public string? MCardName { get; set; } = string.Empty;
}